import {createRouter,createWebHistory} from 'vue-router'
import LoginVue from '@/view/Login.vue';
import LayoutVue from '@/view/Layout.vue';
import ArticleCategory from '@/ArticleView/ArticleCategory.vue';
import ArticleManage from '@/ArticleView/ArticleManage.vue';
import UserInfo from '@/UserView/UserInfo.vue';
import UserManage from '@/UserView/UserManage.vue';
import UserAvatar from '@/UserView/UserAvatar.vue';
import UserResetPassword from '@/UserView/UserResetPassword.vue';
import BlogVue from '@/view/BlogHome.vue'
import ArticleDetailed from '@/view/ArticleDetailed.vue';

//定义路由关系
const routes = [
    {path:'/login',component:LoginVue},
    {path:'/',component:LayoutVue,redirect:'/article/category',
        children:[
            {path:'/article/category',component:ArticleCategory},
            {path:'/article/manage',component:ArticleManage},
            {path:'/user/info',component:UserInfo},
            {path:'/user/manage',component:UserManage},
            {path:'/user/avatar',component:UserAvatar},
            {path:'/user/resetPassword',component:UserResetPassword}
            
    ]},
    {path:'/home',component:BlogVue},
    {path:'/article/:id',component:ArticleDetailed}
    
]

//创建路由器
const router = createRouter({
    history:createWebHistory(),
    routes:routes
});

//导出
export default router